package com.project.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.SuppliersBean;
import com.project.mapper.ISuppliersMapper;
import com.project.service.ISuppliersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class SupplierServiceImpl implements ISuppliersService {

    @Autowired
    private ISuppliersMapper mapper;


    @Override
    public PageInfo<SuppliersBean> findByItem(int page, int pageSize, String suppliersName, String suppliersRange) {
        PageHelper.startPage(page,pageSize);
        PageInfo<SuppliersBean>pageInfo=PageInfo.of(mapper.findByItem(suppliersName,suppliersRange));
        return pageInfo;
    }

    @Override
    public SuppliersBean findById(int id) {
        return mapper.findById(id);
    }

    @Override
    public void addSuppliers(SuppliersBean suppliers) {
        mapper.addSuppliers(suppliers);
    }

    @Override
    public void updateSuppliers(int id, String suppliersManager, String suppliersPhone) {
        mapper.updateSuppliers(id, suppliersManager, suppliersPhone);
    }
}
